import type { ResponseData } from '@/utils/types.d';
import { SUCCESS_CODE } from '@/utils/types.d';
import type { RenewalRecordTableItem } from './types.d';
import request from '@/utils/request';

export async function queryRenewalRecords(data: any, sort: any) {
  const res: ResponseData<{ total: number; data: RenewalRecordTableItem[] }> = await request(
    '/api/member/v1.0.0/renewals',
    {
      params: {
        data,
        sort,
      },
    },
  );
  if (res?.code === SUCCESS_CODE)
    return { success: true, total: res.data.total, data: res.data.data };
  return { success: false, total: 0, data: [] };
}
